// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

//------------------------------------------------------------------------------
// <auto-generated>
//     Types declaration for SharpDX.Direct3D11 namespace.
//     This code was generated by a tool.
//     Date : 29/03/2015 20:58:23
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Security;
namespace SharpDX.Direct3D11 {

#pragma warning disable 419
#pragma warning disable 1587
#pragma warning disable 1574

    /// <summary>	
    /// Functions	
    /// </summary>	
    /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='SharpDX.Direct3D11.D3DX11Effects']/*"/>	
    static partial class D3DX11Effects
    {
        /// <summary>	
        /// <p>Creates an effect from a binary effect or file.</p>	
        /// </summary>	
        /// <param name="dataRef"><dd>  <p>Blob of compiled effect data.</p> </dd></param>	
        /// <param name="dataLength"><dd>  <p>Length of the data blob.</p> </dd></param>	
        /// <param name="fXFlags"><dd>  <p>No effect flags exist. Set to zero.</p> </dd></param>	
        /// <param name="deviceRef"><dd>  <p>Pointer to the <strong><see cref="SharpDX.Direct3D11.Device"/></strong> on which to create Effect resources.</p> </dd></param>	
        /// <param name="effectOut"><dd>  <p>Address of the newly created <strong><see cref="SharpDX.Direct3D11.Effect"/></strong> interface.</p> </dd></param>	
        /// <param name="srcName">No documentation.</param>	
        /// <returns><p>The return value is one of the values listed in Direct3D 11 Return Codes.</p></returns>	
        /// <remarks>	
        /// <p><strong>Note</strong>??You must use Effects 11 source to build  your effects-type application. For more info about using Effects 11 source, see Differences Between Effects 10 and Effects 11.</p>	
        /// </remarks>	
        /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='D3DX11CreateEffectFromMemory']/*"/>	
        /// <msdn-id>ff476273</msdn-id>	
        /// <unmanaged>HRESULT D3DX11CreateEffectFromMemory([In, Buffer] const void* pData,[In] SIZE_T DataLength,[In] unsigned int FXFlags,[In] ID3D11Device* pDevice,[Out, Fast] ID3DX11Effect** ppEffect,[In, Optional] const char* srcName)</unmanaged>	
        /// <unmanaged-short>D3DX11CreateEffectFromMemory</unmanaged-short>	
        public static void CreateEffectFromMemory(System.IntPtr dataRef,
            SharpDX.PointerSize dataLength,
            int fXFlags,
            SharpDX.Direct3D11.Device deviceRef,
            SharpDX.Direct3D11.Effect effectOut,
            string srcName)
        {
            unsafe
            {
                IntPtr effectOut_ = IntPtr.Zero;
                IntPtr srcName_ = Utilities.StringToHGlobalAnsi(srcName);
                SharpDX.Result __result__;
                if(IntPtr.Size == 4)
                {
                    __result__ = D3DX11CreateEffectFromMemory_11_1_x86(dataRef, dataLength, fXFlags, deviceRef.NativePointer, out effectOut_, srcName_);
                }
                else
                {
                    __result__ = D3DX11CreateEffectFromMemory_11_1_x64(dataRef, dataLength, fXFlags, deviceRef.NativePointer, out effectOut_, srcName_);
                }
                ((SharpDX.Direct3D11.Effect)effectOut).NativePointer = effectOut_;
                Marshal.FreeHGlobal(srcName_);
                __result__.CheckError();
            }
        }

        [DllImport("sharpdx_direct3d11_1_effects_x86.dll", EntryPoint = "D3DX11CreateEffectFromMemory")]
        private static extern SharpDX.Result D3DX11CreateEffectFromMemory_11_1_x86(IntPtr dataPointer,
            IntPtr dataLength,
            int fxFlags,
            IntPtr devicePtr,
            out IntPtr effectOut,
            IntPtr srcName);

        [DllImport("sharpdx_direct3d11_1_effects_x64.dll", EntryPoint = "D3DX11CreateEffectFromMemory")]
        private static extern SharpDX.Result D3DX11CreateEffectFromMemory_11_1_x64(IntPtr dataPointer,
            IntPtr dataLength,
            int fxFlags,
            IntPtr devicePtr,
            out IntPtr effectOut,
            IntPtr srcName);
    }
}
